import { createApp } from "vue";
import { createPinia } from "pinia";
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";

import App from "./App.vue";
import router from "./router";

const app = createApp(App);

app.use(createPinia());
app.use(router);
app.use(ElementPlus);

// 在挂载应用前初始化用户状态
import { useUserStore } from "./stores/user";
const userStore = useUserStore();

userStore.initialize().then(() => {
  app.mount("#app");
});
